package com.vesystem.vegua.config;

import cn.hutool.system.SystemUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
 * @auther hcy
 * @create 2020-12-08 17:58
 * @Description
 */
@Configuration
public class GlobalConfig {

    public static String PROXY_IP;
    public static Integer PROXY_PORT;
    public static String BASE_PATH;
    public static String INIT_PWD;
    public static String PROXY_RDP_SECURITY;
    public static String EXTEND_UAM_CHECK_TOKEN_URL;
    public static final String BASE_PATH_ABOUT_ICON = "appIcon/";
    /**
     * 其他基础文件或者应该被保存的文件，存放到该目录。
     * eg: 上传的lince文件
     */
    public static final String BASE_PATH_ABOUT_OTHER = "other/";






    @Value("${gua.proxyIP}")
    public void setProxyIp(String ip){
        PROXY_IP = ip;
    }

    @Value("${gua.proxyPort}")
    public void setProxyPort(Integer port){
        PROXY_PORT = port;
    }

    @Value("${gua.basePath}")
    public void setBasePath(String path){
        if ( path.startsWith("./") ){
            BASE_PATH = path;
        }else {
            String osName = SystemUtil.getOsInfo().getName().toLowerCase();
            if ( osName.indexOf("windows")>=0 ){
                BASE_PATH ="C:\\" + path;
            }else{
                BASE_PATH ="/" + path;
            }
        }
    }

    @Value("${gua.initPwd}")
    public void setInitPwd(String pwd){
        INIT_PWD = pwd;
    }

    @Value("${gua.ProxyRdpSecurity}")
    public void setProxyRdpSecurity(String securityStr){
        PROXY_RDP_SECURITY = securityStr;
    }

    @Value("${extend.uam.checkTokenUrl}")
    public void setExtendUamCheckTokenUrl(String url){
        EXTEND_UAM_CHECK_TOKEN_URL = url;
    }

}
